package com.glodon.paas.activity.api.bean;

import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * 活动，做输入用， 客户端提交的活动数据
 * 
 * @author a
 */
@XmlRootElement(name = "activityIn")
public class ActivityIn {
    // 活动者
    private String                  actorId;        // 活动者ID:accountId
    private String                  actorName;      // 活动者名:displayName

    // 活动来源
    private Integer                 appId;          // 活动来源:应用id
    private Integer                 moduleId;       // 活动来源:模块id
    private Long                    activityType;   // 活动类型:由各应用自定义

    // item
    private String                  itemId;         // 活动物体id等
    private String                  itemName;       // 活动物体类型名：ccc.jpg等
    private String                  subItemId;      // 二级关联实体id等 ，如 项目 + 文件; 文件夹 + 文件;
    private String                  subItemName;    // 二级关联实体
    private String                  itemType;       // 活动物体类型:file等

    private String                  title;          // 动态标题，可以由其他属性组合
    private String                  content;        // 评论或回复内容，用户输入的
    private String                  displayContent; // 显示文本

    private Date                    publishTime;    // 客户端提交时间

    private String                  ext1;           // 扩展属性1,复杂对象自行序列化成json
    private String                  ext2;           // 扩展属性2
    // 在ext1，ext2能满足使用的条件下，尽量避免使用extension属性
    //private HashMap<String, Object> extension;      // 扩展属性
    
    private Set<String>            receiverIds;    // 活动接受者ID
    
    public void addReceiver(String receivers) {
        if (receiverIds == null) {
            receiverIds = new HashSet<String>();
        }
        receiverIds.add(receivers);
    }
    
    public void addReceiver(Collection<String> receivers) {
        if (receiverIds == null) {
            receiverIds = new HashSet<String>();
        }
        receiverIds.addAll(receivers);
    }
    
    public void setReceiverIds(Set<String> receiverIds) {
        this.receiverIds = receiverIds;
    }
    
//    public void putExtension(String key, Object value) {
//        if (extension == null) {
//            extension = new HashMap<String, Object>();
//        }
//        extension.put(key, value);
//    }
//    
//    public Set<String> getReceiverIds() {
//        return receiverIds;
//    }
//    
//    public HashMap<String, Object> getExtension() {
//        return extension;
//    }
//
//    
//    public void setExtension(HashMap<String, Object> extension) {
//        this.extension = extension;
//    }

    public Integer getAppId() {
        return appId;
    }

    public void setAppId(Integer appId) {
        this.appId = appId;
    }

    public Long getActivityType() {
        return activityType;
    }

    public void setActivityType(Long activityType) {
        this.activityType = activityType;
    }

    public String getItemId() {
        return itemId;
    }

    public void setItemId(String itemId) {
        this.itemId = itemId;
    }

    public String getItemName() {
        return itemName;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    public String getActorId() {
        return actorId;
    }

    public void setActorId(String actorId) {
        this.actorId = actorId;
    }

    public String getActorName() {
        return actorName;
    }

    public void setActorName(String actorName) {
        this.actorName = actorName;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getPublishTime() {
        return publishTime;
    }

    public void setPublishTime(Date publishTime) {
        this.publishTime = publishTime;
    }

    public String getItemType() {
        return itemType;
    }

    public void setItemType(String itemType) {
        this.itemType = itemType;
    }

    public Integer getModuleId() {
        return moduleId;
    }

    public void setModuleId(Integer moduleId) {
        this.moduleId = moduleId;
    }

    public String getSubItemId() {
        return subItemId;
    }

    public void setSubItemId(String subItemId) {
        this.subItemId = subItemId;
    }

    public String getSubItemName() {
        return subItemName;
    }

    public void setSubItemName(String subItemName) {
        this.subItemName = subItemName;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    public String getDisplayContent() {
        return displayContent;
    }

    public void setDisplayContent(String displayContent) {
        this.displayContent = displayContent;
    }

    public Set<String> getReceiverIds() {
        return receiverIds;
    }

}
